import java.io.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2024-09-10
 * Time: 14:49
 */


//Reader,Writer
public class demo3 {
    public static void main1(String[] args) throws IOException {
        File file = new File("./test.txt");
        Reader reader = new FileReader(file);
        char[] chars = new char[1024];
        reader.read(chars);
    }

    public static void main(String[] args) {
        File file = new File("./test.txt");
        String s = "Hello World";
        try (Writer writer = new FileWriter(file, true)) {
            writer.write(s);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
